/********************************************************************
Name: Matrix Completion Tables and Figures (Table A3, Figure A1)
Author: Dan Thompson
Date: September 2021
Description: 

********************************************************************/

clear all
gl path = "~/Dropbox/Mariel Effects"

* Matrix completion table (Table A1)
import delim "$path/Replication/modified_data/matrix_completion_output.csv", clear
sort year
quietly {
	cap log close
	log using "$path/Replication/output/mc_by_yr_table.tex", text replace
	noisily dis "\begin{table}[ht]"
	noisily dis "\centering"
	noisily dis "\caption{\textbf{Increase in Republican Presidential Vote Share "
	noisily dis "After the Mariel Boatlift, Matrix Completion.}\label{tab:mc_yr}}"
	noisily dis "\begin{tabular}{ccc}"
	noisily dis "\toprule \toprule"
	noisily dis " & \multicolumn{2}{c}{Counties in Control Pool} \\"
	noisily dis " & 250 & 555 \\[1mm]"
	noisily dis "\midrule"
	noisily dis " 1980 & " %3.2f effect250[6] " & " %3.2f effect555[6] " \\"
	noisily dis " 1984 & " %3.2f effect250[7] " & " %3.2f effect555[7] " \\"
	noisily dis " 1988 & " %3.2f effect250[8] " & " %3.2f effect555[8] " \\"
	noisily dis " 1992 & " %3.2f effect250[9] " & " %3.2f effect555[9] " \\"
	noisily dis " 1996 & " %3.2f effect250[10] " & " %3.2f effect555[10] " \\"
	noisily dis " 2000 & " %3.2f effect250[11] " & " %3.2f effect555[11] " \\"
	noisily dis "\bottomrule \bottomrule"
	noisily dis "\multicolumn{3}{p{.3\textwidth}}{\footnotesize"
	noisily dis "All estimates calculated holding out counties that border Miami-Dade. "
	noisily dis "The 250 or 555 counties most similar to Miami-Dade in terms of 1978 population "
	noisily dis "are included in the control pool.}"
	noisily dis "\end{tabular}"
	noisily dis "\end{table}"
	log off
}

* Matrix completeness figure (Figure A3) 
preserve
replace control555 = control555*100
replace treated555 = treated555*100
twoway (line control555 year, lc(gs2) lp(dash)) ///
	(line treated555 year, lc(gs2)), ///
	legend(order(2 "Miami-Dade" 1 "Matrix Completion Control")) ///
	yti("Rep Pres Vote Pct") ///
	xli(1980, lc(gs8) lp(shortdash)) ///
	graphregion(color(white)) ///
	name("mc555", replace)
graph export "$path/Replication/output/matrix_completion555.pdf", replace name("mc555")
restore



